fix: resolve cross-package test failures and type errors#44
Open
stooit wants to merge 1 commit into
Open
Conversation
- ui/bunfig + root bunfig: register happy-dom environment so React component tests have a DOM - web/api: import renamed hook useDebounce (was useThrottle) from @e2e/utils - tsconfig: add bun-types so bun:test resolves under tsc - Button: forward aria-label with icon-only fallback for a11y - DataTable: use functional state updater to fix stale-closure sort toggle - format/date: use en-AU dateStyle:short for DD/MM/YYYY ordering
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all failing tests and type errors in the monorepo.
bun testis now 13 pass / 0 fail andnpx tsc --noEmitis clean. No test files were modified and no dependencies were added.Bugs fixed
apps/web/src/lib/api.tsimporteduseThrottlefrom@e2e/utils, but the hook was renamed touseDebounce. Updated the import.packages/ui/.../Button.tsxnever forwarded thearia-labelprop. Now appliesaria-label, with a fallback so icon-only buttons always emit a non-null label, while normal text buttons emit none.packages/ui/.../DataTable.tsxhandleSorttoggled sort direction from a capturedsortDir. Switched to the functional updatersetSortDir(prev => ...)so repeated clicks toggle correctly.packages/utils/src/format/date.tsproduced US MM/DD ordering underen-AU. Now usesdateStyle: "short"for the expected DD/MM ordering.Test-infrastructure fixes (config only, no tests touched)
bun testfrom the root never registered a DOM, so all React component tests threwdocument is not defined. Registeredhappy-dom(already installed) viabunfig.toml[test]environment + preload of the existing setup script.bun:testtypes: addedbun-types(already a devDependency) totsconfig.jsoncompilerOptions.typessotscresolvesbun:testimports in test files.Verification
bun test-> 13 pass, 0 failnpx tsc --noEmit-> no errorsAssumptions
date.tsusesdateStyle: "short", which yields non-zero-padded values (e.g.15/6/24); the date tests assert via prefix regex and pass. Did not change tests to require zero-padding.